#include "xmlrpcbase64.h"

namespace XmlRpc {

XmlRpcBase64::XmlRpcBase64(QObject *parent)
    : QObject(parent)
{
}

XmlRpcBase64::XmlRpcBase64(const XmlRpcBase64 &other)
    : QObject(0)
{
    m_bytes = other.m_bytes;
}

XmlRpcBase64::XmlRpcBase64(const QByteArray &encoded)
{
    m_bytes = encoded;
}

QByteArray XmlRpcBase64::encoded() const
{
    return m_bytes;
}

QByteArray XmlRpcBase64::decoded() const
{
    return QByteArray::fromBase64(m_bytes);
}

void XmlRpcBase64::setEncoded(const QByteArray &encoded)
{
    m_bytes = encoded;
}

void XmlRpcBase64::setDecoded(const QByteArray &decoded)
{
    m_bytes = decoded.toBase64();
}

QString XmlRpcBase64::toString() const
{
    return QString(decoded());
}

} // namespace XmlRpc
